<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: csnf
  Date: 2024/12/26
  Time: 20:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>课程列表</title>
</head>
<body>
  <form action="getCourse">
      <input type="text" name="name" placeholder="请输入课程名称">
      <input type="submit" value="查询">
  </form>
  <a href="saveCourse">添加课程</a>
  <table border="1">
      <tr>
          <th>课程名</th>
          <th>课程人数</th>
          <th>开始时间</th>
          <th>结束时间</th>
          <th>教师</th>
          <th>操作</th>
      </tr>
      <c:forEach items="${courseList}" var="course">
          <tr>
              <td>${course.name}</td>
              <td>${course.number}</td>
              <td>${course.startTime}</td>
              <td>${course.endTime}</td>
              <td>${course.teacher}</td>
              <td>
                  <a href="deleteCourseById?id=${course.id}">删除</a>
              </td>
          </tr>
      </c:forEach>
  </table>
    <p>${msg}</p>
    <script>
        function deleteCourse(id) {
            if (confirm("确定删除吗？")) {
                location.href = "deleteCourseById?id=" + id;
            }
        }
    </script>
</body>
</html>
